package com.pro.controller;

import com.alibaba.fastjson.JSON;
import com.pro.pojo.JsonData;
import com.pro.service.WelcomeService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * ClassName:WelcomeController
 * Package:com.pro.controller
 * Description:
 *
 * @Date:2022/1/21 18:00
 * @Author: ZPT
 */
@RequestMapping("/welcome")
@RestController
public class WelcomeController {
    @Autowired
    private WelcomeService welcomeService;

    /**
     * @author ZPT
     * @date 2022/1/21 17:27
     * @content :上架商品总数 1
     */
    @RequestMapping("/getGoodsSum")
    public JsonData getGoodsSum(Integer productSate) {
        Integer goodsSum = welcomeService.getGoodsSum(productSate);
        return goodsSum != null ? JsonData.buildSuccess(goodsSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/21 17:27
     * @content :上传视频总数 上架2
     */
    @RequestMapping("/getCourseStatusSum")
    public JsonData getCourseStatusSum(Integer courseStatus) {
        Integer courseSum = welcomeService.getCourseStatusSum(courseStatus);
        return courseStatus != null ? JsonData.buildSuccess(courseStatus) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/21 17:28
     * @content :发布微圈总数
     */
    @RequestMapping("/getMicrocircleSum")
    public JsonData getMicrocircleSum() {
        Integer microcircleSum = welcomeService.getMicrocircleSum();
        return microcircleSum != null ? JsonData.buildSuccess(microcircleSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/21 17:28
     * @content :已完成订单总数 签收6 退订待审核量 退货申请7
     */
    @RequestMapping("/getOrderSum")
    public JsonData getOrderSum(Integer orderStatus) {
        Integer orderSum = welcomeService.getOrderSum(orderStatus);
        return orderSum != null ? JsonData.buildSuccess(orderSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/21 17:37
     * @content :商品、课程、微圈待审核量 2、待审核 2视频、3、商品 4、微圈
     */
    @RequestMapping("/getExamineSum")
    public JsonData getExamineSum(String result, Integer type) {
        Integer examineSum = welcomeService.getExamineSum(result, type);
        return examineSum != null ? JsonData.buildSuccess(examineSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/21 17:47
     * @content :今日新增用户
     */
    @RequestMapping("/getTodayUserSum")
    public JsonData getTodayUserSum() {
        Integer todayUserSum = welcomeService.getTodayUserSum();
        return todayUserSum != null ? JsonData.buildSuccess(todayUserSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/21 17:47
     * @content :昨日新增用户
     */
    @RequestMapping("/getYesterdayUserSum")
    public JsonData getYesterdayUserSum() {
        Integer yesterdayUserSum = welcomeService.getYesterdayUserSum();
        return yesterdayUserSum != null ? JsonData.buildSuccess(yesterdayUserSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/21 17:47
     * @content :本月新增用户
     */
    @RequestMapping("/getMonthUserSum")
    public JsonData getMonthUserSum() {
        Integer monthUserSum = welcomeService.getMonthUserSum();
        return monthUserSum != null ? JsonData.buildSuccess(monthUserSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/22 18:23
     * @content :本月新增课程数量
     */
    @RequestMapping("/getCourseMonthAddCount")
    public JsonData getCourseMonthAddCount() {
        Integer courseMonthAddCount = welcomeService.getCourseMonthAddCount();
        return courseMonthAddCount != null ? JsonData.buildSuccess(courseMonthAddCount) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/22 18:24
     * @content :本周用户申请成功数量
     */
    @RequestMapping("/getUserAddWeekCount")
    public JsonData getUserAddWeekCount() {
        Integer userAddWeekCount = welcomeService.getUserAddWeekCount();
        return userAddWeekCount != null ? JsonData.buildSuccess(userAddWeekCount) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/22 18:40
     * @content :上一个月的新增课程数量
     */
    @RequestMapping("/getCourseAddLastMonthCount")
    public JsonData getCourseAddLastMonthCount() {
        Integer lastMonthCount = welcomeService.getCourseAddLastMonthCount();
        return lastMonthCount != null ? JsonData.buildSuccess(lastMonthCount) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/22 19:28
     * @content :上一个月的用户数量
     */
    @RequestMapping("/getUserAddLastMonthCount")
    public JsonData getUserAddLastMonthCount() {
        Integer addLastMonthCount = welcomeService.getUserAddLastMonthCount();
        return addLastMonthCount != null ? JsonData.buildSuccess(addLastMonthCount) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/23 21:04
     * @content :上传视频总数
     */
    @RequestMapping("/getCourseSum")
    public JsonData getCourseSum() {
        Integer courseSum = welcomeService.getCourseSum();
        return courseSum != null ? JsonData.buildSuccess(courseSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/23 20:44
     * @content :视频浏览、收藏、点赞量
     */
    @RequestMapping("/getCourseQuantitySum")
    public JsonData getCourseQuantitySum(String field, Integer courseStatus) {
        Integer courseQuantitySum = welcomeService.getCourseQuantitySum(field, courseStatus);
        return courseQuantitySum != null ? JsonData.buildSuccess(courseQuantitySum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/23 21:12
     * @content :微圈点赞量
     */
    @RequestMapping("/getMicrocircleQuantitySum")
    public JsonData getMicrocircleQuantitySum(String field) {
        Integer microcircleQuantitySum = welcomeService.getMicrocircleQuantitySum(field);
        return microcircleQuantitySum != null ? JsonData.buildSuccess(microcircleQuantitySum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/21 18:34
     * @content :本周新增量
     */
    @RequestMapping("/getWeekCount")
    public JsonData getWeekCount(String field, String table, String dataType) {
        Map<String, Object> weekCount = welcomeService.getWeekCount(field, table, dataType);
        return weekCount != null ? JsonData.buildSuccess(weekCount) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/24 18:39
     * @content :商品销售总量
     */
    @RequestMapping("/getGoodsSalesSum")
    public JsonData getGoodsSalesSum(Integer orderType, Integer productSate) {
        Integer goodsSalesSum = welcomeService.getGoodsSalesSum(orderType, productSate);
        return goodsSalesSum != null ? JsonData.buildSuccess(goodsSalesSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/24 18:39
     * @content :商品收藏总数
     */
    @RequestMapping("/getGoodsCollectSum")
    public JsonData getGoodsCollectSum(Integer collectionType) {
        Integer goodsCollectSum = welcomeService.getGoodsCollectSum(collectionType);
        return goodsCollectSum != null ? JsonData.buildSuccess(goodsCollectSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/24 19:13
     * @content :订单总数
     */
    @RequestMapping("/getOrderCount")
    public JsonData getOrderCount() {
        Integer orderCount = welcomeService.getOrderCount();
        return orderCount != null ? JsonData.buildSuccess(orderCount) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/24 19:18
     * @content :本月新增商品
     */
    @RequestMapping("/getGoodsMonthAddSum")
    public JsonData getGoodsMonthAddSum() {
        Integer goodsMonthAddSum = welcomeService.getGoodsMonthAddSum();
        return goodsMonthAddSum != null ? JsonData.buildSuccess(goodsMonthAddSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/24 19:18
     * @content :上个月新增商品
     */
    @RequestMapping("/getGoodsLastMonthAddSum")
    public JsonData getGoodsLastMonthAddSum() {
        Integer goodsLastMonthAddSum = welcomeService.getGoodsLastMonthAddSum();
        return goodsLastMonthAddSum != null ? JsonData.buildSuccess(goodsLastMonthAddSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/26 18:41
     * @content :前端用户总数
     */
    @RequestMapping("/getBeforeUserSum")
    public JsonData getBeforeUserSum() {
        Integer beforeUserSum = welcomeService.getBeforeUserSum();
        return beforeUserSum != null ? JsonData.buildSuccess(beforeUserSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/26 18:45
     * @content :进思用户总数
     */
    @RequestMapping("/getJinSiBeforeUserSum")
    public JsonData getJinSiBeforeUserSum() {
        Integer jinSiBeforeUserSum = welcomeService.getJinSiBeforeUserSum();
        return jinSiBeforeUserSum != null ? JsonData.buildSuccess(jinSiBeforeUserSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/26 18:46
     * @content :非进思用户总数
     */
    @RequestMapping("/getNoJinSiBeforeUserSum")
    public JsonData getNoJinSiBeforeUserSum() {
        Integer noJinSiBeforeUserSum = welcomeService.getNoJinSiBeforeUserSum();
        return noJinSiBeforeUserSum != null ? JsonData.buildSuccess(noJinSiBeforeUserSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/26 19:04
     * @content :后台用户总数
     */
    @RequestMapping("/getUserSum")
    public JsonData getUserSum() {
        Integer userSum = welcomeService.getUserSum();
        return userSum != null ? JsonData.buildSuccess(userSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/26 19:12
     * @content :创作者认证待处理信息 1
     */
    @RequestMapping("/getPendingApplyRecordSum")
    public JsonData getPendingApplyRecordSum(Integer result) {
        Integer pendingApplyRecordSum = welcomeService.getPendingApplyRecordSum(result);
        return pendingApplyRecordSum != null ? JsonData.buildSuccess(pendingApplyRecordSum) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @date 2022/1/26 19:28
     * @content :上一个月的前端用户量
     */
    @RequestMapping("/getLastAddBeforeUserSum")
    public JsonData getLastAddBeforeUserSum() {
        Integer lastAddBeforeUserSum = welcomeService.getLastAddBeforeUserSum();
        return lastAddBeforeUserSum != null ? JsonData.buildSuccess(lastAddBeforeUserSum) : JsonData.buildError("服务端错误");
    }
}
